﻿using System;
using System.Collections.Generic;
 
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Facebook;
using Facebook.Web;

public partial class City : Facebook.Web.CanvasIFrameBasePage
{

    public string UserID = "0";
    public string SessionKey = "0";

     protected override void OnPreInit(EventArgs e)
    {
       
        // base.RequireLogin = true;

        base.OnPreInit(e);

        //if (!string.IsNullOrEmpty(Request["auth_token"]) && string.IsNullOrEmpty(this.Api.AuthToken))
        //    this.Api.AuthToken = Request["auth_token"];
        //else
        //    Response.Redirect(this.Api.LoginUrl);
        //



        //this.re = "http://localhost/metropoline/default.aspx";

    }

     protected override void OnInit(EventArgs e)
     {
         base.OnInit(e);
         CitySelect.SelectedIndexChanged += new EventHandler(CitySelect_SelectedIndexChanged);
     }

     void CitySelect_SelectedIndexChanged(object sender, EventArgs e)
     {
         UserID = CitySelect.SelectedValue;

     }
 

    protected void Page_Load(object sender, EventArgs e)
    {
        Facebook.Rest.Api facebookapi =   ( this as CanvasIFrameBasePage).Api;

        if (facebookapi.Auth.Session.UserId != 0)
        {
            UserID = (facebookapi.Auth.Session.UserId).ToString();
            SessionKey = (facebookapi.Auth.Session.SessionKey).ToString();
        }


        //UserID = "100000217572082";
        //SessionKey = "1010101019202910192";
         //  facebookapi.Auth.Session.SessionKey

    }
}
